package com.shy.springboot.config;

import com.shy.springboot.condition.JettyWebServerCondition;
import com.shy.springboot.condition.TomcatWebServerCondition;
import com.shy.springboot.server.TomcatWebServer;
import com.shy.springboot.server.WebServer;
import com.shy.springboot.server.JettyWebServer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebServerAutoConfiguration {
    @Conditional(TomcatWebServerCondition.class)
    @Bean
    public WebServer tomcatWebServer() {
        return new TomcatWebServer();
    }

    @Conditional(JettyWebServerCondition.class)
    @Bean
    public WebServer jettyWebServer() {
        return new JettyWebServer();
    }
}
